import request from '@/utils/request'

// 查询酒店订单列表
export function listOrders (query) {
  return request({
    url: '/huacai/orders/listByUserId',
    method: 'get',
    params: query
  })
}

// 查询酒店订单详细
export function getOrders (orderId) {
  return request({
    url: '/huacai/orders/' + orderId,
    method: 'get'
  })
}

// 新增酒店订单
export function addOrders (data) {
  return request({
    url: '/huacai/orders',
    method: 'post',
    data: data
  })
}

// 修改酒店订单
export function updateOrders (data) {
  return request({
    url: '/huacai/orders',
    method: 'put',
    data: data
  })
}

// 删除酒店订单
export function delOrders (orderId) {
  return request({
    url: '/huacai/orders/' + orderId,
    method: 'delete'
  })
}

// 获取支付二维码
export function getPaymentQRCode (orderNo, paymentMethod) {
  return request({
    url: '/huacai/orders/payment/qrcode',
    method: 'get',
    params: {
      orderNo,
      paymentMethod
    }
  })
}

// 账户余额支付
export function balancePayment (orderNo) {
  return request({
    url: '/huacai/orders/payment/balance',
    method: 'post',
    data: {
      orderNo
    }
  })
}

// 检查支付状态
export function checkPaymentStatus (orderNo) {
  return request({
    url: '/huacai/orders/payment/status/' + orderNo,
    method: 'get'
  })
}

// 支付订单
export function payOrder (orderNo) {
  return request({
    url: '/huacai/orders/pay/' + orderNo,
    method: 'post'
  })
}

// 确认收货
export function confirmReceived (orderNo) {
  return request({
    url: '/huacai/orders/confirm/' + orderNo,
    method: 'post'
  })
}

export function getOrderDetail (orderId) {
  console.log(orderId, 'orderId');

  return request({
    url: '/huacai/orders/orderDetail/' + orderId,
    method: 'get'
  })
}
